package com.xyg.product.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.xyg.common.model.DataEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name="xyg_product_template")
public class Template extends DataEntity<Template, Long>{
	private String name;
	
	private String description;
	
	/**参数*/
	@ElementCollection(fetch = FetchType.LAZY)
	@CollectionTable(name = "xyg_product_template_param")
	private Map<Property,String> params = new HashMap<>();

	/** 展示图片 */
	@ElementCollection(fetch=FetchType.LAZY)
	@CollectionTable(name = "xyg_product_template_showimage")
	private List<Image> showImages = new ArrayList<>();
	
	/** 详情图片 */
	@ElementCollection(fetch=FetchType.LAZY)
	@CollectionTable(name = "xyg_product_template_detailimage")
	private List<Image> detailImages = new ArrayList<>();
	
	@ManyToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private List<PropertyValue> propertyValues = new ArrayList<>();
	
}
